/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.teacake.filteringproxy;
import java.io.OutputStream;
import java.util.Formatter;
/**
 *
 * @author tkleisas
 */
public class Logfile {
    public Logfile(String filename) throws Exception
    {
        try
        {
            this.m_filename = filename;
            m_fos = new java.io.FileOutputStream(m_filename);
            m_initialized = true;
        }
        catch(java.io.IOException e)
        {
            m_fos = null;

        }
        catch(Exception e)
        {
            m_fos = null;
        }
    }
    public synchronized void write(byte[] data)
    {
        try
        {
            m_fos.write(data);
            m_fos.flush();

        }
        catch(Exception e)
        {

        }
    }
    public synchronized void write(String message)
    {

        this.write(message.getBytes());
    }

    public boolean isInitialized()
    {
        return m_initialized;
    }
    private String m_filename;
    private OutputStream m_fos;
    private boolean m_initialized;

}
